/*
 * 
 * 
 */

package DigimonAdventure.World;

import DigimonAdventure.MP3Player.MusicPlayer;
import DigimonAdventure.Things.AbstractThings;
import DigimonAdventure.Things.DigimonBoss;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.JFrame;

/**
 *
 * @author Kris Derril Siregar
 */
public abstract class AbstractWorld {
	protected ArrayList <AbstractThings> ownThings; //Tentukan size arena berapa?
	protected AbstractBattlefield field;
	
    protected int jumlahDigimon; //jumlah digimon saat ini 10
    protected ThreadGroup threadDigimon;

    protected Random rnd;
    protected boolean hasBoss;
    protected DigimonBoss boss;
   
    public int getJumlahDigimon(){
        return jumlahDigimon;
    }
	
	public boolean isHasBoss(){
        return hasBoss;
    }
    public DigimonBoss getBoss(){
        return boss;
    }
	public AbstractBattlefield getField(){
        return field;
    }
	public AbstractThings getThings(int x,int y){
        x = x / 20;
        y = y / 20;
        x *= 20;
        y *= 20;
        
        AbstractThings ret = null;
        for(AbstractThings p : ownThings){
            synchronized(p){
                if(p.getX() == x && p.getY() == y){
                     ret = p;
                     break;
                }
            }
        }
        return ret;
    }
	public ArrayList<AbstractThings> getCompleteThings(){
        return ownThings;
    }
    protected abstract void createThreadDigimon();

    AbstractWorld(){
        jumlahDigimon = 10;
        ownThings = new ArrayList<AbstractThings>();
        rnd = new Random(System.currentTimeMillis());
        
    }
    
}
